--狙击隐匿
local jujiyingni = fk.CreateSkill {
    name = "mcdh_jujiyingni"
}

local U = require "packages/utility/utility"
local lib = require "packages/mcdh/lib"

jujiyingni:addEffect(fk.Damaged,{
    can_trigger = function(self, event, target, player, data)
        if not player:hasSkill(self) or target ~= player then return false end
       return true
    end,
    on_cost = function(self, event, target, player, data)
        return player.room:askForSkillInvoke(player, self.name)
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        room:addPlayerMark(player, "@mcdh_jujiyingni-mark", 1)
    end
})

jujiyingni:addEffect(fk.TargetConfirming,{
    can_trigger = function(self, event, target, player, data)
        if not player:hasSkill(self) or target ~= player then return false end
        return data.from ~= player.id and player:getMark("@mcdh_jujiyingni-mark") > 0
    end,
    on_cost = function(self, event, target, player, data)
       return true
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        room:removePlayerMark(player, "@mcdh_jujiyingni-mark", 1)
        AimGroup:cancelTarget(data, player.id)
    end
})

Fk:loadTranslationTable {
    ["mcdh_jujiyingni"] = "狙击隐匿",
    [":mcdh_jujiyingni"] = "当你受到伤害后，你可以获得1枚「匿」。当你成为其他角色使用牌的目标时，你移去1枚「匿」并取消此目标。",
    ["@mcdh_jujiyingni-mark"] = "匿"
}

return jujiyingni